[iphone,twitter] Accessing the Twitter API through a proxy using NSURLConnectionsm, OAuth problem
Posted
by akaii
on Stack Overflow
See other posts from Stack Overflow
or by akaii
Published on 2010-05-23T09:16:43Z
Indexed on
2010/05/23
9:20 UTC
Read the original article
Hit count: 334
I'm having no problems with sending an update directly via hxxps://api.twitter.com/, but the app (for the Iphone, I'm using NSURLConnections) I'm working is supposed to allow the user to select a preferred proxy (e.g. hxxps://twitter-proxy.appspot.com/api/ or hxxps://nest.onedd.net/api/), and I keep getting a 401 error (Failed to validate oauth signature and token) whenever I try to get an access token via these proxies. Even though I send my POST request to the proxy, I am still using the direct url for the api (https:// api.twitter.com/[rest api path]) in the base string.
Despite the 401 error message above, the status code I'm actually getting from connection:didReceiveResponse: is 200, probably because it was able to successfully contact the proxy...
Is there anything else that I need to consider when using a proxy to access the API? Should anything in the authorization header change, for example? Or the base string?
I can manage to connect via Basic Auth without issue, but support for that will be dropped in a month.
On a somewhat unrelated note...
What are the possible causes of Twitter's error 403, and how do you distinguish between them? Is the only way to differentiate an error due to exceeding the status update limit for an hour (150 per hour) vs for a day (1000 per day) by checking the string reply returned in the response?
Is there any way for me to simulate a status update limit error without going through the motions of actually sending 150/1000 tweets?
© Stack Overflow or respective owner